const path = require('path')
const fs = require('fs')

const root = path.resolve(__dirname)

const dirList = fs.readdirSync(root)
dirList.forEach(item => {
  if (fs.statSync(path.join(root, item)).isDirectory()) {
    const files = fs.readdirSync(path.join(root, item))
    files.forEach(fileName => {
      if (fileName.endsWith('.vue')) {
        console.log(fileName)
        fs.renameSync(path.join(root, item, fileName), path.join(root, item, 'index.vue'))
      }
    })
  }
})
